/*
* @Author: zhanghang
* @Date:   2018-05-20 14:53:33
* @Last Modified by:   zhanghang
* @Last Modified time: 2018-05-20 15:35:10
*/
import React from 'react'
import {connect }from 'react-redux'
import {login} from './Auth.redux.js'
import {Redirect} from'react-router-dom'

@connect (
    state =>state.auth,
    {login}
    )
class Auth extends React.Component {
    constructor(props){
        super(props)
    }

    render(){
        return (
            <div>
            {this.props.isAuth?<Redirect to='/dashboard'></Redirect>: null}

                <h2>需要登录</h2>
                <button onClick={this.props.login}>登录</button>

            </div>)
    }
}

export default Auth